<?php
require_once('../phplib/include.inc.php');

class ModifyUser extends PageBase{
	public function Ini(){
		PageBase::RequireLogin();
		Util::ValidateRight(1);
		$this->GetProduct();
	}
	public function GetProduct(){
		/* @var $db DbMySQL */
		$db = getDb();
		$db->connect();
		$products = $db->fetch("SELECT * FROM product_t");
		$this->assign('products',$products);
	}
	public function ParseRequest(){
		if(!isset($_REQUEST['uid'])) PageBase::Error('非法访问！');
		$uid = intval($_REQUEST['uid']);
		/* @var $db DbMySQL */
		$db = getDb();
		$db->connect();
		$uinfo = $db->fetchOne("SELECT uname,job FROM user_t WHERE uid=$uid");
		if($uinfo == null) PageBase::Error('参数错误，没有该用户.');
		$uinfo = json_encode($uinfo);
		$this->assign('uid',$uid);
		$this->assign('uinfo',$uinfo);
		$rids = $db->fetch('SELECT * FROM right_t WHERE uid='.$uid);
		$rids = json_encode($rids);
		$this->assign('rids',$rids);
	}
}
$modifyuser = new ModifyUser("file:".dirname(__FILE__)."/../home/modifyuser.tpl.html");
$modifyuser->display();
?>